 var login='';
    var win='';
Ext.onReady(function(){
	var callback = function(response, e) {
	// uncomment if you want to inspect arguments in Firebug Console
	//	        console.log(response, e);

			var status = '<b>Success</b>'
			var text = '';

			// success handling - e.status is success flag: 
			// true is success, false is failure
			if (true === e.status) {
				// response argument is same as e.result
				text = response[1]['name'];
			}

			// failure handling
			else {
				status = '<b><i>Failure</i></b>'

				// in the case of an exception, we don't have response but message
				text = e.message;
			}

			// grab the center body
			Ext.Msg.alert('info',status+text);
		};

		Ext.QuickTips.init();

		// Create a variable to hold our EXT Form Panel. 
		// Assign various config options as seen.	 
		login = new Ext.FormPanel({
			labelWidth : 80,
			//url:'/auth/service/Doctor_clear_password_auth',
			frame : true,
			title : 'Please Login',
			defaultType : 'textfield',
			monitorValid : true,
			bodyStyle : zurl("background:url(/static/images/expr/dl.jpg);"),
			layout : 'absolute',

			// Specific attributes for the text fields for username / password. 
			// The "name" attribute defines the name of variables sent to the server.
			items : [ {
				fieldLabel : 'Username',
				name : 'loginUsername',
				allowBlank : false,
				x : 260,
				y : 110

			}, {
				fieldLabel : 'Password',
				name : 'loginPassword',
				inputType : 'password',
				allowBlank : false,
				x : 260,
				y : 160
			} ],

			// All the magic happens after the user clicks the button     
			buttons : [ {
				text : 'Login',
				formBind : true,
				// Function that fires when user clicks the button 
				handler : function() {
					form = login.getForm();
					values = form.getValues();
					username = values['loginUsername'];
					pwd = values['loginPassword'];
					Doctor_clear_password_auth.do_auth(username, pwd,callback);

				}
			} ]

		});

		// This just creates a window to wrap the login form. 
		// The login object is passed to the items collection.       
		win = new Ext.Window({
			layout : 'fit',
			width : 450,
			height : 355,
			closable : false,
			resizable : false,
			plain : true,
			border : false,
			items : [ login ]
		});
		win.show();

	});